package com.example.httptest.contoller;

import com.example.httptest.entity.User;
import com.example.httptest.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@ResponseBody
public class UserController {


    @Autowired
    UserService userService;

    @RequestMapping(value = "/register",method = RequestMethod.POST)
    public boolean register(@RequestParam("userName") String  userName, @RequestParam("password")String password,@RequestParam("nickName")String nickName) {

        return userService.register(userName,password,nickName);
    }

    @PostMapping(value = "/login")
    public User loginCheck(@RequestParam("userName") String userName, @RequestParam("password")String password) {

        return userService.loginCheck(userName, password);
    }



}
